package com.zuohuaipan.headine.view;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.EditText;
import android.widget.ImageView;

import com.zuohuaipan.headine.R;

public class WebActivity extends AppCompatActivity {

    private WebView wv;
    private EditText edit;
    private ImageView iv_fx;
    private ImageView iv_sc;
    private ImageView iv_pl;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_web);
        //初始化控件
        initView();
        //得到传过来的值
        Intent intent = getIntent();
        String newsurl = intent.getStringExtra("newsurl");
        //设置webview
        setWebview(newsurl);


    }

    private void initView() {
        wv = (WebView) findViewById(R.id.wv);
        edit = (EditText) findViewById(R.id.web_edit);
        iv_pl = (ImageView) findViewById(R.id.web_pl);
        iv_sc = (ImageView) findViewById(R.id.web_sc);
        iv_fx = (ImageView) findViewById(R.id.web_fx);
    }

    public void setWebview(String url) {
        wv.loadUrl(url);
        wv.setWebViewClient(new WebViewClient() {
            @Override
            public void onLoadResource(WebView view, String url) {
                super.onLoadResource(view, url);
            }
        });
    }
}
